package cn.bdqn.dept.summer.api;


import cn.bdqn.dept.client.DeptFeignClient;
import cn.bdqn.model.pojo.Dept;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * @Author 徐凤年
 * @Date 2022/3/25 16:48
 * @Version 1.0
 */
@RestController
public class DeptController {
    @Autowired
    DeptFeignClient deptFeignClient;

    @GetMapping("/dept/get/{id}")
    @ApiOperation("根据用户id获得部门信息")
    public Dept getDept(@PathVariable("id") int id){
        return deptFeignClient.getDeptId(id);
    }

    @PostMapping("/dept/add")
    @ApiOperation("添加信息")
    public boolean addDept(@RequestBody Dept dept){
        System.out.println("消费者");
        System.out.println(dept);
        return deptFeignClient.deptAdd(dept);
    }
}
